/*
 * BLinkStreetPartial.java
 * 
 * Copyright 2008 David D. Emory
 * 
 * This file is part of Five Points. See <http://www.fpdev.org> for
 * additional information regarding the project.
 * 
 * Five Points is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Five Points is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Five Points.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.fpdev.core.basenet;

public class BLinkStreetPartial extends BLinkStreet {

  private BNode addrNode_,  endNode_;

  public BLinkStreetPartial(BLinkStreet parent, BNode fNode, BNode tNode, double factor) {
    super(parent.getScenario(), parent.getID(), 0, fNode, tNode, parent.getDisplayName(), (int) ((double) Math.min(factor, 1 - factor) * parent.getLengthFeet()));//(int) computeLength(factor, parent.getLengthFeet()));
    //System.out.println("set length: "+getLengthFeet());
    //System.out.println("parent length: "+parent.getLengthFeet());
    //setEdge(parent.getEdge());
    if (fNode.isAddressNode()) {
      addrNode_ = fNode;
      endNode_ = tNode;
    } else if (tNode.isAddressNode()) {
      addrNode_ = tNode;
      endNode_ = fNode;
    } else {
      System.err.println("Error: niether CLinkStreetPartial node is address node");
    }
  }

  /*private double computeLength(double factor, double pLength) {
  return Math.min(factor, 1-factor)*pLength;
  }*/
  public int getClassType() {
    return BLink.CLASS_STREETPARTIAL;
  }

  public BNode getAddressNode() {
    return addrNode_;
  }

  public BNode getEndNode() {
    return endNode_;
  }
  //public boolean isPartial() { return true; }
}





























